export default {
	//get请求从config.url获取参数，post从config.body中获取参数
	param2Obj(url){
		const search= url.split('?')[1]
		if(!search){
			return {}
		}
		return JSON.parse(
		'{"' +
			decodeURIComponent(search)
			.replace(/"/g,'\\"')
			.replace(/&/g,'","')
			.replace(/=/g,'":"') +
		'"}'
		)
	},
	
	formatDate(datetime) {
		if (datetime != null) {
			const dateMat = new Date(datetime)
			const year = dateMat.getFullYear()
			const month = dateMat.getMonth() + 1
			const day = dateMat.getDate()
			const hh = dateMat.getHours()
			const mm = dateMat.getMinutes()
			const ss = dateMat.getSeconds()
			const timeFormat = year + '-' + month + '-' + day + ' ' + hh + ':' + mm + ':' + ss
			return timeFormat
		}
		else{
			return ''
		}
	}
	
}